/**
 * MatrixFX: effect_progression example.
 *
 * This demo progresses to the next effect
 * after every 500 frames.
 *
 * The nextEffect() method can be called from
 * within an external interrupt if
 * you want to use a button to change effect.
 */

//include sprite, matrix and matrixfx libraries
#include "Sprite.h"
#include "Matrix.h"
#include <MatrixFX.h>

const int dataPin = 3;
const int clockPin = 4;
const int loadPin = 5;

int x = 0;

//initialise matrix library
MatrixFX fx = MatrixFX(dataPin, clockPin, loadPin);

/**
 * Sets up the application
 */
void setup() { 
    fx.setBrightness(10);  //set the initial brightness
    fx.initEffect(rain);
}

/**
 * Main program loop.
 */
void loop() {
    fx.update();    //print the next frame to the matrix
    delay(75);
    
    x++;
    if (x == 500) {    //go to the next ffect after 500 frames.
        x = 0;
        fx.nextEffect();   
    }
}
